|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectcontrolP5.ControllerGroup
controlP5.ControlGroup
public class ControlGroup
use a controlGroup to bundle several controllers, controlGroups can be closed and opened to keep the screen organized. ControlGroup extends ControllerGroup, for a list and documentation of available methods see the ControllerGroup documentation.
/**
* ControlP5 Group
* by andreas schlegel, 2009
*/
import controlP5.*;
ControlP5 controlP5;
void setup() {
size(400,400);
frameRate(30);
controlP5 = new ControlP5(this);
ControlGroup l = controlP5.addGroup("myGroup",100,200);
controlP5.addBang("A-1",0,4,20,20).setGroup(l);
controlP5.addBang("A-2",30,4,20,20).setGroup(l);
l.setBackgroundColor(color(255,100));
l.setBackgroundHeight(150);
println("the height of controlgroup l: "+l.getBackgroundHeight());
ControlGroup l2 = controlP5.addGroup("myGroup2",100,40,200);
l2.activateEvent(true);
controlP5.addBang("B-1",0,4,20,20).setGroup(l2);
Radio r = controlP5.addRadio("radio",100,4);
r.add("black",0);
r.add("red",1);
r.add("green",2);
r.add("blue",3);
r.add("grey",4);
r.setColorLabel(0xffff0000);
r.setGroup(l2);
}
void draw() {
background(0);
}
void controlEvent(ControlEvent theEvent) {
if(theEvent.isGroup()) {
println("got an event from group "+theEvent.group().name()+", isOpen? "+theEvent.group().isOpen());
} else if (theEvent.isController()){
println("got something from a controller "+theEvent.controller().name());
}
}
void keyPressed() {
if(key==' ') {
controlP5.group("myGroup").remove();
}
}
| Field Summary |
|---|
| Fields inherited from interface controlP5.ControlP5Constants |
|---|
acceptClassList, ACTIVE, ALT, ARC, ARRAY, BACKSPACE, BOOLEAN, BOTTOM, CENTER, CONTROL, controlEventClass, CUSTOM, DECREASE, DEFAULT, DELETE, DOWN, ELLIPSE, ENTER, ESCAPE, EVENT, eventMethod, FIELD, FLOAT, HALF_PI, HIDE, HIGHLIGHT, HORIZONTAL, IMAGE, INCREASE, INTEGER, INVALID, KEYCONTROL, LEFT, LINE, LOAD, MENU, METHOD, MOVE, OVER, PI, PRESSED, PRINT, RELEASE, RESET, RIGHT, SAVE, SHIFT, SPRITE, STRING, SWITCH, SWITCH_BACK, SWITCH_FORE, TAB, TOP, TWO_PI, UP, VERBOSE, VERTICAL |
| Constructor Summary | |
|---|---|
ControlGroup(ControlP5 theControlP5,
ControllerGroup theParent,
java.lang.String theName,
int theX,
int theY,
int theW,
int theH)
|
|
| Method Summary | |
|---|---|
ControlGroup |
activateEvent(boolean theFlag)
activate or deactivate the Event status of a tab. |
void |
addCloseButton()
TODO redesign or deprecate add a close button to the controlbar of this controlGroup. |
void |
addToXMLElement(ControlP5XMLElement theElement)
|
float[] |
arrayValue()
|
void |
controlEvent(ControlEvent theEvent)
ControlListener is an interface that can be implemented by a custom class. |
int |
getBackgroundHeight()
get the height of the controlGroup's background. |
void |
hideBar()
|
boolean |
isBarVisible()
|
void |
mousePressed()
|
void |
removeCloseButton()
TODO redesign or deprecate remove the close button. |
void |
setArrayValue(float[] theArray)
|
void |
setBackgroundColor(int theColor)
set the background color of a controlGroup. |
void |
setBackgroundHeight(int theHeight)
set the height of the controlGroup's background. |
void |
setBarHeight(int theHeight)
set the height of the top bar (used to open/close and move a controlGroup). |
void |
showBar()
|
java.lang.String |
stringValue()
!!! experimental, see ControllerGroup.value() |
java.lang.String |
toString()
|
float |
value()
!!! experimental, see ControllerGroup.value() |
| Methods inherited from class controlP5.ControllerGroup |
|---|
absolutePosition, add, addCanvas, addDrawable, captionLabel, close, color, continuousUpdateEvents, controller, disableCollapse, draw, enableCollapse, getAsXML, getColor, getHeight, getPickingColor, getTab, getWidth, getWindow, hide, id, init, isCollapse, isMoveable, isOpen, isUpdate, isVisible, isXMLsavable, keyEvent, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, name, open, parent, position, remove, remove, remove, removeCanvas, setColorActive, setColorBackground, setColorForeground, setColorLabel, setColorValue, setGroup, setGroup, setHeight, setId, setLabel, setMousePressed, setMoveable, setOpen, setPosition, setTab, setTab, setTab, setUpdate, setVisible, setWidth, show, update, updateAbsolutePosition, updateEvents, updateInternalEvents, valueLabel |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ControlGroup(ControlP5 theControlP5,
ControllerGroup theParent,
java.lang.String theName,
int theX,
int theY,
int theW,
int theH)
| Method Detail |
|---|
public void mousePressed()
public ControlGroup activateEvent(boolean theFlag)
theFlag - booleanpublic int getBackgroundHeight()
public void setBackgroundHeight(int theHeight)
theHeight - public void setBackgroundColor(int theColor)
theColor - public void setBarHeight(int theHeight)
theHeight - public void addToXMLElement(ControlP5XMLElement theElement)
addToXMLElement in interface ControllerInterfacetheElement - ControlP5XMLElementpublic void addCloseButton()
public void removeCloseButton()
public void hideBar()
public void showBar()
public boolean isBarVisible()
public void controlEvent(ControlEvent theEvent)
ControlListener
controlEvent in interface ControlListenertheEvent - ControlEvent
Controllerpublic java.lang.String stringValue()
stringValue in interface ControllerInterfacestringValue in class ControllerGrouppublic float value()
value in interface ControllerInterfacevalue in class ControllerGrouppublic float[] arrayValue()
arrayValue in class ControllerGrouppublic void setArrayValue(float[] theArray)
public java.lang.String toString()
toString in class ControllerGroup
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||